import { get, post, del } from './request.js'

module.exports = {
  createOrders: function (params) {
    return post('/borrow/create', params);
  },
  getOrderById: function (id) {
    return get(`/borrow/${id}`);
  },
  getOrdersByUserId: function (uid, type, start = 0) {
    return get(`/borrow/user/${uid}`, { type, start });
  },
  cancelOrderByOrderId: function (id) {
    return post(`/borrow/${id}/cancel`)
  },
  renewBookByOrderId: function (id) {
    return post(`/borrow/${id}/renew`);
  },
  deleteOrderByOrderId: function (id) {
    return del(`/borrow/${id}`);
  },
  getRecordsByUser:function(id,start=0){
    return get('/collect/record/'+id,{start});
  }
}
